package demo2.assignment1;

public class TestNpuInfo {

    private static int hashCode;

    public static void main(String[] args) {
        // 测试在10万线程高并发的情况下，是否会创建不同对象
        for (int i = 0; i < 100000; i++) {
            new Thread(() -> {
                NpuInfo npuInfo = NpuInfo.getInstance();
                int code = npuInfo.hashCode();
                if (hashCode == 0 || hashCode != code) {
                    hashCode = code;
                    System.err.println("Code changed:" + code);
                }
            }).start();
        }
    }
}
